import requests
import json
# response = requests.get("http://www.baidu.com/")
#print (response.text)
# 也可以这么写
# response = requests.request("get", "http://www.baidu.com/")
kw = {
	"newDeptFlag":0,
	"userName":"sunyue1",
	"bizCode":"YY",
	"funcCode":"FC_risk_users",
	"operCodes": [ "C", "R", "U", "D" ],
	"typeCodeList": [ "01", "05", "09","21" ]
}
 
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36","X-Gaia-Api-Key":"99c74f76-698d-4028-8bc3-8ae950762ee2","Content-Type":"application/json" }
 
# params 接收一个字典或者字符串的查询参数，字典类型自动转换为url编码，不需要urlencode()
response = requests.post("http://api.longfor.uat/iam-openapi-uat/public/v2/org/getByFuncOperCodesTypeCodes", json = kw, headers = headers)
 
# 查看响应内容，response.text 返回的是Unicode格式的数据
#print (response.text)
decodejson = json.loads(response.text)
print (decodejson)
for item in decodejson["data"]:
    print (item["operCode"],item.get("operName",""))
    for org in item["orgList"]:
        print (org["name"],org["code"])